#node src/js/commands/instrument.js --inlineIID --inlineSource -i --inlineJalangi --analysis src/js/sample_analyses/ChainedAnalyses.js --analysis src/js/sample_analyses/dlint/Utils.js --analysis src/DCG.js --outputDir /home/passwd123/XiaoweiGuo/vscode/code-security/temp /home/passwd123/XiaoweiGuo/vscode/code-security/third_party/jalangi2/tests/html/dommodel1/test.js
#node src/js/commands/jalangi.js --inlineIID --inlineSource --analysis /home/passwd123/XiaoweiGuo/vscode/code-security/scripts/dynamic_dcg.js /home/passwd123/XiaoweiGuo/vscode/code-security/temp/test_orig_.js

import os
import sys

binary_path='/home/passwd123/XiaoweiGuo/vscode/code-security/third_party/jalangi2/src/js/commands/jalangi.js'

addon_path='/home/passwd123/XiaoweiGuo/vscode/code-security/scripts/dynamic_dcg.js'



target_file='/home/passwd123/XiaoweiGuo/vscode/code-security/data/js/jstap_train/good/0bcde6dd675babc36aed31e29edd8fb44166198e.js'

cmd=f'{binary_path} --inlineIID --inlineSource --analysis {addon_path} {target_file}'

caches_files=[]
caches_files.append(target_file[:-3]+"_jalangi_.js")
caches_files.append(target_file[:-3]+"_jalangi.json")

os.system(cmd)

#move caches file to temp folder
for file in caches_files:
    if os.path.exists(file):
        os.rename(file, "/home/passwd123/XiaoweiGuo/vscode/code-security/temp/"+file.split("/")[-1])




